package com.zeldu.question.service.impl;


import com.zeldu.question.mapper.libraryMapper;
import com.zeldu.question.pojo.questionLibrary;
import com.zeldu.question.service.libraryService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class libraryServiceIpml implements libraryService {

    @Autowired(required = false)
    private libraryMapper libraryMapperl;

    @Override
    public int response(questionLibrary questionLibrary){
        //Teacher teacher = JWTInfo.getTeacherJwt();
        questionLibrary ques = new questionLibrary();
//        从jwt获取
        //ques.setTeacherId(teacher.getId());
        ques.setTeacherId(questionLibrary.getTeacherId());
        ques.setSubject(questionLibrary.getSubject());
        ques.setCreateTime(questionLibrary.getCreateTime());
        ques.setType(questionLibrary.getType());
        ques.setQuestion(questionLibrary.getQuestion());
        ques.setChoice(questionLibrary.getChoice());
        ques.setGrade(questionLibrary.getGrade());
        return libraryMapperl.insert(ques);
    }

    @Override
    public List<questionLibrary> getQues(String subject){
        return libraryMapperl.getQues(subject);
    }
}
